<?xml version="1.0"?>
<Model name="euclid">

  <TypeDef name="uint16" type="unsigned" width="16"/>
	
	<Module name="simple">
	<Datapath>
		<!-- Connectors -->
		<Connector name="a_in" kind="queue" direction="in" type="uint16"/>
																			
		<SignalFlowGraph name="run">		
			<Expression>
				$display(a_in);
			</Expression>			
		</SignalFlowGraph>		
		
		</Datapath>
		<Controller>
		<State name="s0" initial="true"/>	
		<State name="s1"/>

		<TransitionSet source="s0">		
			<Wait target="s1">
				<QueueReadyEvent name="a_in"/>
			</Wait>
		</TransitionSet>
		
		<TransitionSet source="s1">		
			<Transition target="s0">			
				<ExecutionSet>
					<SignalFlowGraphRef name="run"/>				
				</ExecutionSet>
			</Transition> 			
		</TransitionSet>					
					
	</Controller>
	</Module>
	
	
	<Module name="test_simple">
	<Datapath>
		<Connector name="a_out" kind="queue" direction="out" type="uint16"/>

		<Register name="count" type="uint16"/>
		
		<SignalFlowGraph name="sfg1">
			<Expression>
				count = count + 1;
			</Expression>
			<Expression>
				a_out = count;		
			</Expression>
			<Expression>
				$display("a_out: ", a_out);		
			</Expression>	
		</SignalFlowGraph>				
	</Datapath>

	<Controller>
		<State name="s0" initial="true"/>		
		<TransitionSet source="s0">			
			<Transition target="s0">
				<ExecutionSet>
			 		<SignalFlowGraphRef name="sfg1"/>			 
				</ExecutionSet>	
			</Transition>
		</TransitionSet>				
		
	</Controller>
	</Module>
	
	
	<System name="S">
		<!-- connection name is optional -->
		<Queue name="a" type="uint16"/>
		
		<Use name="SIMPLE" entity="simple">
			<Connect connector="a_in"  channel="a"/>
		</Use>
		
		<Use name="TEST_SIMPLE" entity="test_simple">
			<Connect connector="a_out" channel="a"/>
		</Use>				
	</System>
</Model>
